package business;

import java.util.List;

import models.Group;
import models.forms.GroupForm;
import dao.GroupDao;
import dao.impl.GroupDaoImpl;

public class GroupBusiness {
	private GroupDao groupDao;

	public GroupBusiness() {
		this.groupDao = new GroupDaoImpl();
	}
	
	public List<Group> selectList(Group group){
		return groupDao.selectList(group);
	}
	
	public void save(GroupForm form){
		Group group = new Group();
		group.setName(form.getGroupName());
		group.setPrivate(form.isPrivate());
		groupDao.insert(group);
	}
	
	public List<Group> selectByUserId(String userId){
		return groupDao.selectByUserId(userId);
	}
	
	public List<Group> selectAll(){
		return groupDao.selectAll();
	}
}
